const USER_KEY = '__USER__'
const LIKE_LIST_KEY = '__LIKELIST__'

function setItem(key, item) {
	localStorage.setItem(key, item)
}

function getItem(key) {
	return localStorage.getItem(key)
}

export function setUser(user = {}) {
	setItem(USER_KEY, JSON.stringify(user))
}

export function getUser() {
	const user = getItem(USER_KEY)
	if (user) {
		return JSON.parse(user)
	}
	return null
}

export function setLikeList(LikeList = []) {
	setItem(LIKE_LIST_KEY, JSON.stringify(LikeList))
}

export function getLikeList() {
	const likelist = getItem(LIKE_LIST_KEY)
	if (likelist) {
		return JSON.parse(likelist)
	}
	return null
}
